const mongoose = require('mongoose')
const Schema = mongoose.Schema
const schema = new Schema({
  name: { type: String },
  avatar: { type: String },
  bg: { type: String },
  title: { type: String },
  categories: [
    {
      // mongoose.Schema.Types.ObjectId
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Category'
    }
  ],
  scores: {
    difficulty: { type: Number },
    skill: { type: Number },
    attack: { type: Number },
    survey: { type: Number }
  },
  skills: [
    {
      icon: { type: String },
      name: { type: String },
      description: { type: String },
      cd: { type: String },
      consume: { type: String }
    }
  ],
  items1: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Item' }],
  items2: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Item' }],
  usageTips: { type: String },
  battleTips: { type: String },
  teamTips: { type: String },
  patners: [
    {
      hero: { type: mongoose.Schema.Types.ObjectId, ref: 'Hero' },
      description: { type: String }
    }
  ]
})

module.exports = mongoose.model('Hero', schema, 'heroes')
